<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div class="slider" id="jd">
    <div class="inner">
        <ul>
            <li><a href="#"><img src="images/01.jpg" alt=""/></a></li>
            <li><a href="#"><img src="images/02.jpg" alt=""/></a></li>
            <li><a href="#"><img src="images/03.jpg" alt=""/></a></li>
            <li><a href="#"><img src="images/04.jpg" alt=""/></a></li>
            <li><a href="#"><img src="images/05.jpg" alt=""/></a></li>
        </ul>
    </div>
    <ol id="box">
        <li class="current">1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
        <div>
            <ul>
                <li>aads</li>
                <li>aads</li>
                <li>aads</li>
                <li>aads</li>
                <li>aads</li>
                <li>aads</li>
            </ul>
        </div>
    </ol>
</div>
<script>
    var obj = document.body;
    function myGetByTagName(obj,tag){
        tag = tag.toUpperCase();
        var relArr = [];
        function myGetByTagName(obj,tag){
            if (obj.children.length>0){
                if (obj.nodeName == tag){
                    relArr.push(obj)
                }
                for(var i = 0;i<obj.children.length;i++){
                    myGetByTagName(obj.children[i],tag);
                }
            } else {
                if (obj.nodeName==tag){
                    relArr.push(obj)
                }
            }

        }
        myGetByTagName(obj,tag);
        return relArr;
    }


    var arr = myGetByTagName(document.body,'div');
    console.log(arr)
//    var arr2 = myGetByTagName(document.getElementById('box'),'li');
//    console.log(arr2);

</script>
</body>
</html>